﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Prototype_Game_1
{
    abstract class Sprite
    {
        protected Texture2D textureImage;
        protected Point size;
        protected int collisionOffset;
        protected Vector2 speed;
        protected Vector2 position;
        protected string name;

        public Sprite(string name, Texture2D textureImage, Vector2 position, Point size, int collisionOffset, Vector2 speed)
        {
            this.name = name;
            this.textureImage = textureImage;
            this.position = position;
            this.size = size;
            this.collisionOffset = collisionOffset;
            this.speed = speed;
        }

        public virtual void Update(GameTime gameTime, Rectangle clientBounds)
        {
            
        }

        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(textureImage,
            position,
            null,
            Color.White, 0, Vector2.Zero,
            1f, SpriteEffects.None, 0);
        }

        public string Name
        {
            get { return name; }
        }

        public abstract Vector2 direction
        {
            get;
        }

        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
            
        }

        public Texture2D TextureImage
        {
            get { return textureImage; }
            set { textureImage = value; }
        }

        public virtual Rectangle collisionRect
        {
            get
            {
            return new Rectangle(
            (int)position.X + collisionOffset,
            (int)position.Y + collisionOffset,
            size.X - (collisionOffset * 2),
            size.Y - (collisionOffset * 2));
            }
        }       
    }
}
